package com.ninthgroup.controller;

import com.ninthgroup.entity.Scheduling;
import com.ninthgroup.service.SchedulingService;
import com.ninthgroup.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * @author ：1452863884@qq.com rcg
 * @date ：Created in 2022/10/20 15:52
 * @description：排班管理的控制层
 * @modified By：
 * @version:1.0
 */
@RestController
@RequestMapping("/scheduling")
public class SchedulingController {

    @Autowired
    private SchedulingService schedulingService;

    @GetMapping("/select")
    public Result selectAll() {
        return schedulingService.selectAll();
    }

    @GetMapping("/selectone")
    public Result selectAllOne(Integer sDid) {
        return schedulingService.selectOne(sDid);
    }

    @PostMapping("/update")
    public Result update(@RequestBody Scheduling scheduling) {

        return schedulingService.updateScheduling(scheduling);
    }

    @PostMapping("/add")
    public Result add(@RequestBody Scheduling scheduling) {

        return schedulingService.add(scheduling);
    }

    @PostMapping("/jianshuliang")
    public Result decreaseNum(@RequestBody Scheduling scheduling) {
        return schedulingService.lessNum(scheduling);
    }
}